<template>
	<div>
		<Bluetable :tHead="tHead" :tData="tableData" @operateClick="operateClick"></Bluetable>
		<pagination :total="query.total" :page.sync="query.page" :limit.sync="query.limit" @pagination="getList" />
	</div>
</template>

<script>
	export default {
		name:"Ptcintable",
		props:{
			search:{
				type:Object
			}
		},
		data () {
			return {
				query:{
					total:0,
					page:1,
					limit:10
				},
				tHead:[
					{
						label:"序号",
						index:true
					},
					{
						prop:"mz_jz_zyh",
						label:"住院号"
					},
					{
						prop:"patientName",
						label:"病人姓名"
					},
					{
						prop:"sex",
						label:"性别"
					},
					{
						prop:"birthday",
						label:"出生"
					},
					{
						prop:"disName",
						label:"诊断"
					},
					{
						prop:"deptName",
						label:"处方科室"
					},
					{
						prop:"doctorName",
						label:"处方医生"
					},
					{
						prop:"slCode_txt",
						label:"警示级别"
					},
					{
						prop:"phar_state_txt",
						label:"处方状态"
					},
					{
						prop:"add_time",
						label:"操作时间"
					},
					{
						prop:"phar_cnname",
						label:"审核药师"
					},
					{
						prop:"date",
						label:"操作",
						operate:["查看"]
					}
				],
				tableData: [],
			}
		},
		mounted(){
			this.getList();
		},
		watch:{
			search(){
				this.getList();
			}
		},
		methods:{
			async getList() {
				let res=await this.$ptc.outpatientSearch({
					type:"zy",
					mz_jz_zyh:this.search.mz_jz_zyh,
					patientId:this.search.patientId,
					patientName: this.search.patientName,
					zd_dept_codes: this.search.zd_dept_codes,
					zd_dept_names: this.search.zd_dept_names,
					zd_drug_codes: this.search.zd_drug_codes,
					zd_drug_names:this.search.zd_drug_names, 
					zd_doc_codes: this.search.zd_doc_codes,
					zd_doc_names: this.search.zd_doc_names,
					zd_phr_codes: this.search.zd_phr_codes,
					zd_phr_names: this.search.zd_phr_names,
					slCode:this.search.slCode,
					phar_state:this.search.phar_state,
					startTime: this.search.startTime,
					endTime: this.search.endTime,
					page: this.query.page,
					pageSize: this.query.limit
				});
				for(var i=0;i<res.rows.length;i++){
					res.rows[i].sex=this.$utils.sexFormat(res.rows[i].sex);
					res.rows[i].add_time=this.$utils.timeFormat(res.rows[i].add_time);
				}
				this.tableData=res.rows;
				this.query.total=res.total;
			},
			operateClick(val,row){
				this.$emit("changeSeekPop",row)
			}
		}
	}
</script>

<style>
</style>
